package summer_vacation.cullen.two10;

import java.util.Scanner;

/**
 * Created by Cullen on 2015/8/11.
 */
public class N27 {
    public static void main(String[] args) {
        System.out.println("请输入a的值：");
        Scanner x=new Scanner(System.in);
        int a=x.nextInt();
        System.out.println("请输入b的值：");
        Scanner y=new Scanner(System.in);
        int b=x.nextInt();
        System.out.println("请输入c的值：");
        Scanner z=new Scanner(System.in);
        int c=x.nextInt();
        if ((b*b)-4*a*c<0){
            System.out.println("此方程无解！");
        }else if((b*b)-4*a*c==0){
            double X=(-b)/(2*a);
            System.out.println("方程的唯一根是："+X);
        } else {
            double X1=(double)(-b+Math.sqrt((b*b)-4*a*c))/(2*a);
            double X2=(double)(-b-Math.sqrt((b*b)-4*a*c))/(2*a);
            System.out.println("方程的根分别是："+X1);
            System.out.println(+X2);
        }
    }
}
